import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutterproject/mvvm/base/base_state.dart';
import 'package:flutterproject/page/login_all/login/widget/input_eye.dart';
import 'package:flutterproject/page/login_all/register/controller/register_controller.dart';
import 'package:flutterproject/util/extension/extension_util.dart';
import 'package:flutterproject/util/extension/widget_extension.dart';
import 'package:flutterproject/util/margin_padding_util.dart';
import 'package:flutterproject/widget/button_common.dart';
import 'package:flutterproject/widget/text/text_common.dart';
import 'package:get/get.dart';

class RegisterPage extends BaseState<RegisterController> {
  @override
  RegisterController initController() => RegisterController();

  @override
  Widget initView(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: false,
      body: Container(
        width: Get.width,
        height: Get.height,
        padding: MarginPaddingUtil.symmetric(horizontal: 50),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            237.heightBox,
            TextCommon(
              "您好！欢迎注册",
              size: 50.sp,
              color: Color(0xFFFF242429),
            ),
            172.heightBox,
            InputEye(
              hint: '请输入手机号',
              isPhone: true,
              controller: controller.textEditingController,
              onchange: (value) => controller.onChange(),
              focusNode: controller.registerFocusNode,
            ),
            Spacer(),
            Row(
              children: [
                SizedBox.shrink(),
                Spacer(),
                TextCommon(
                  "已有账号？",
                  size: 28.sp,
                  color: Color(0xFFFF707070),
                ),
                TextCommon(
                  "去登录",
                  size: 28.sp,
                  color: Color(0xFFEDC88B),
                ),
              ],
            ).addClickEvent(() => Get.back()),
            42.heightBox,
            ButtonCommon(
              text: "下一步",
              onTap: () {
                controller.showConfirmDialog();
              },
              fontSize: 32.sp,
              fontColor: Colors.white,
              color: controller.isPhoneCorrect
                  ? Color(0xFFEDC88B)
                  : Color(0xFF6E6E6E).withOpacity(0.5),
              borderRadios: 50,
              padding: MarginPaddingUtil.only(top: 25, bottom: 29),
            ),
            36.heightBox,
          ],
        ),
      ),
    );
  }
}
